<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>測試</title>
    <script type="text/javascript" src="/js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        $(function () {
            bindEvent()
        })
        function bindEvent() {
            $("#btn").click(function () {
                var sname=$("#sname").val();
                var cid=$("#cid").val();
                var id=$("#id").val();
                $.ajax({
                    url:"/com/zb/cn/update",
                    type:"post",
                    dataType:"json",
                    data:{"sname":sname,"cid":cid,"id":id},
                    success:function (mes) {
                        var count=parseInt(mes);
                        if(count>0){
                            window.location="/index.html";
                        }else{
                            window.location="/info.html";
                        }
                    }
                })
            })
        }
    </script>
</head>
<body>
    <div>
            <table>
                <tr>
                    <td>学生Id：<input name="id" th:value="${s.id}" id="id" readonly></td>
                </tr>
                <tr>
                    <td>学生姓名:<input name="name" th:value="${s.name}" id="sname"></td>
                </tr>
                <tr>
                    <td>班级ID:<input name="aClass.id" th:value="${s.aClass.id}" id="cid"></td>
                </tr>
                <tr>
                    <td>班级名称：<input name="aClass.name" th:value="${s.aClass.name}" readonly></td>
                </tr>
                <tr>
                    <td><input id="btn" type="button" value="修改"></td>
                </tr>
            </table>
    </div>
</body>
</html>